# Contributor: Laurent Bercot <ska-devel@skarnet.org>
# Maintainer: Laurent Bercot <ska-devel@skarnet.org>
pkgname=s6-linux-init
pkgver=1.1.2.1
pkgrel=1
pkgdesc="Set of tools to create and run an s6-based init system"
url=https://skarnet.org/software/s6-linux-init/
arch="all"
license="ISC"
options="!check"
_skalibs_version=2.14.3
_execline_version=2.9.6
_s6_version=2.13.1
depends="execline>=$_execline_version s6>=$_s6_version"
makedepends="skalibs-dev>=$_skalibs_version execline-dev>=$_execline_version s6-dev>=$_s6_version linux-headers"
subpackages="$pkgname-static $pkgname-libs $pkgname-dev $pkgname-doc"
source="https://skarnet.org/software/s6-linux-init/s6-linux-init-$pkgver.tar.gz s6-linux-init.pc.in"

build() {
	./configure \
		--enable-shared \
		--disable-allstatic \
		--prefix=/usr \
		--libexecdir=/usr/lib/s6-linux-init \
		--skeldir=/etc/s6-linux-init/skel
	make
}

package() {
	make DESTDIR="$pkgdir" install
	sed -e "s/@@VERSION@@/$pkgver/g; s/@@SKALIBS_VERSION@@/${_skalibs_version}/g;" "$srcdir/$pkgname.pc.in" > "$srcdir/$pkgname.pc"
	install -D -m 0644 "$srcdir/$pkgname.pc" "$pkgdir/usr/lib/pkgconfig/$pkgname.pc"
	mkdir -p "$pkgdir"/usr/share/doc
	cp -a "$builddir"/doc "$pkgdir"/usr/share/doc/$pkgname
}

sha512sums="
343b6a9bdcf3b1abb544409bb2d7a6c8a1dbcb07d1b941ae74e8800e48ad605c6427f724d7692569b3ade4829948d0e57024c764c18a60c3bb2eb2efefedb622  s6-linux-init-1.1.2.1.tar.gz
1e617f0a1ae724c80d0f577c1484297b4aea3107cad6b2589ffeabcad3a12a8ba5de876fd2a6d7ddc03c4e6e9d34938dd0356b273fe62c475ff31da9aef2596d  s6-linux-init.pc.in
"
